package Week3.num.week3Test1.opp02;

public class SalesEmployee extends ColaEmployee {
    private double monthlySales;
    private double royalty;

    /**
     * 空参构造
     */
    public SalesEmployee() {

    }

    /**
     * 全参构造
     */
    public SalesEmployee(String name, int month, double monthlySales, double royalty) {
        super(name, month);
        this.monthlySales = monthlySales;
        this.royalty = royalty;
    }

    /**
     * get和set方法
     */
    public double getMonthlySales() {
        return monthlySales;
    }

    public void setMonthlySales(double monthlySales) {
        this.monthlySales = monthlySales;
    }

    public double getRoyalty() {
        return royalty;
    }

    public void setRoyalty(double royalty) {
        this.royalty = royalty;
    }

    /**
     * 重写获取工资的方法
     * @param month 发放工资月份
     * @return 当月工资
     */
    @Override
    public double getSalary(int month) {
        if (month == this.getMonth()) {
            return (this.getMonthlySales() * this.getRoyalty()+100);
        }
        return (this.getMonthlySales() * this.getRoyalty());
    }
}
